<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateO2oShopOrderTable1554107649 extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		$prefix = config('ibrand.app.database.prefix', 'ibrand_');
		if(!Schema::hasTable($prefix . 'o2o_shop_order')){
			Schema::create($prefix . 'o2o_shop_order', function (Blueprint $table) {

				$table->increments('id');

				$table->integer('type')->default(1);

				$table->integer('bonus')->default(0);

				$table->integer('order_id')->nullable();   //订单ID

				$table->integer('clerk_id')->nullable();

				$table->integer('shop_id')->nullable();   //所管理门店ID

				$table->integer('value')->nullable(); // 提成

				$table->timestamp('confirm_at')->nullable();  //套餐结束时间

				$table->text('images')->nullable();

				$table->timestamps();

				$table->softDeletes();
			});
		}
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		$prefix = config('ibrand.app.database.prefix', 'ibrand_');
		Schema::drop($prefix . 'o2o_shop_order');
	}
}
